//package com.shenbaoiot.openapi.controller;
//
//import com.alibaba.fastjson.JSON;
//import com.shenbaoiot.common.core.controller.BaseController;
//import com.shenbaoiot.common.core.domain.R;
//import com.shenbaoiot.es.domain.dto.DemoEsDTO;
//import com.shenbaoiot.es.service.ElasticsearchService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.io.IOException;
//
//
///**
// * swagger 外放接口方法
// *
// * @author ruoyi
// */
//@Slf4j
//@RestController
//@RequestMapping("/openapi/oauth2")
//public class OpenTestController extends BaseController
//{
//    @Autowired
//    private ElasticsearchService elasticsearchService;
//
//    @GetMapping("/test")
//    public R test()
//    {
//        return R.ok("测试通过！");
//    }
//    @GetMapping("/estest")
//    public R estest() throws IOException {
////        DemoEsDTO demoEsDTO = new DemoEsDTO(22L, "名称"+22, "测试添加(create)", Math.toIntExact(10 + 22));
////        DemoEsDTO demo = (DemoEsDTO) elasticsearchService.createDocument(DemoEsDTO.class, demoEsDTO, "demo", String.valueOf(demoEsDTO.getId()));
////        log.info("添加结果:{}",JSON.toJSONString(demo));
//        DemoEsDTO demo = (DemoEsDTO)elasticsearchService.getDocument(DemoEsDTO.class, "demo", "22");
//        log.info("result:{}",JSON.toJSONString(demo));
//        return R.ok(JSON.toJSONString(demo));
//    }
//
//
//}
